﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.RoleCommand;
using RBAC.MaHaiBo.Entity;
using RBAC.MaHaiBo.Service;
using System.Data;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.RoleHandler
{
    public class RoleUpdateCommandHandlers : IRequestHandler<RoleUpdateCommand, int>
    {
        IRoleService rSer;

        public RoleUpdateCommandHandlers(IRoleService rSer)
        {
            this.rSer = rSer;
        }
        public async Task<int> Handle(RoleUpdateCommand request, CancellationToken cancellationToken)
        {
            return await  rSer.UpdateRole(new Entity.RoleInfo() { Rid= request.Rid,RName = request.Rname });
        }
    }
}
